package com.gitee.wsl.android.ui.theme

import android.content.res.ColorStateList
import com.gitee.wsl.android.ext.base.adjustOpacity
import com.gitee.wsl.android.ext.base.buildColorStateList
import com.gitee.wsl.common.ui.theme.ColorPaletteSchemeBase
import com.gitee.wsl.common.ui.theme.ColorPalette_SYSTEM
import com.gitee.wsl.common.ui.theme.ComposeColorPaletteScheme
import com.gitee.wsl.common.ui.theme.defaultLightColorSet
import com.gitee.wsl.android.ui.theme.local.SystemTheme
import com.gitee.wsl.ext.base.ColorExt


open class SystemPalette: ColorPaletteSchemeBase(defaultLightColorSet) {
    override fun getColorThemeName(): String {
        return  ColorPalette_SYSTEM
    }

    override fun toCompose(): ComposeColorPaletteScheme<Long> {
        return SystemTheme
    }
}

fun ComposeColorPaletteScheme<Number>.imageTintList() : ColorStateList = ColorExt.buildColorStateList(
    android.R.attr.state_selected to primary.toInt(),
    -android.R.attr.state_selected to onSurfaceVariant.toInt(),
    android.R.attr.state_enabled to onSurfaceVariant.toInt(),
    -android.R.attr.state_enabled to ColorExt.adjustOpacity(
        onSurface.toInt(),
        ColorExt.ON_SURFACE_OPACITY_BUTTON_DISABLED
    ))